import redis

class RedisCache:

    rc = ''

    def __init__(self):
        self.rc = redis.StrictRedis(host="localhost",port=6379,db=0,password='',decode_responses=True, charset='UTF-8', encoding='UTF-8')

    def set(self,key,value,ext=60):
        self.rc.hmset(key,value)
        self.rc.expire(key,ext)

    def get(self,name,keys):
        return self.rc.hmget(name,keys)

    def delte(self,names):
        self.rc.delete(names)

    def close(self):
        redis.close()